home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / demos / cbdemo.zip / CBDEMO.APT next >
Text File  |  1991-01-18  |  34KB  |  840 lines

  1. .head 0 +  Application Description: Combo Toolbox Demo program.
  2. Copyright 1991, Todd Steinwart; Advanced Sales Technologies, Inc.
  3. All rights reserved.
  4.  
  5. The version of this application that comes with the release DLL
  6. contains more fully anotated code.  In this sample code, notation 
  7. is provided where necessary for you to understand the basics 
  8. of the DLL operation and its use in SQLWindows.
  9.  
  10. *** The database is NOT required for this demonstration. ***
  11.  
  12. This sample program is provided As Is, and no warranty is made as 
  13. to its fitness for any purpose other than that of demonstration.
  14.  
  15. We will be happy to answer any non-technical questions you have
  16. during your evaluation of this demo system, and provide you with
  17. full support once you have purchased the release version.
  18.  
  19. As explained in the About box text, you may make 100 calls to the
  20. DLL during a single run of your application.  After that, the 
  21. DLL will return CB_ERR for any call you make except ComboBoxCreate.
  22.  
  23. YOU *MUST* CHECK THE RETURN CODE FOR ANY FUNCTION RETURNING A VALUE
  24. BEFORE USING IT ELSEWHERE.  THE VALUE CB_ERR IS NEGATIVE AND AN 
  25. ATTEMPT TO USE IT AS AN INDEX INTO A SQLWINDOWS ARRAY WILL CAUSE
  26. A SQLWINDOWS ABEND.
  27.  
  28. Thank you for your trial of this product.  It has become an
  29. essential part of our SQLWindows arsenal and we hope that it 
  30. will find its way into yours until such a time that Gupta 
  31. Technologies makes combo boxes a standard SQLWindows control.  
  32.  
  33. We also provide SQLWindows consulting and development services 
  34. and have developed numerous other SQLWindows "tricks 
  35. and techniques" that we may make available in the future.  If 
  36. you have ideas for advancing the SQLWindows interface but not
  37. the expertise with the Windows SDK, talk to us.  We may be able to
  38. help....
  39.  
  40. Todd Steinwart 1(919)942-2067
  41. Gregg Morris 1(404)552-7739
  42.  
  43. SQLWindows and SQLBase are registered trademarks of Gupta Technologies,
  44. Inc.  Microsoft and Windows are registered trademarks of Microsoft
  45. Corporation.
  46. .head 1 +  Design-time Settings
  47. .head 2 -  Outline Window State: Normal
  48. .head 2 +  Outline Window Location and Size
  49. .head 3 -  Left:   0.029"
  50. .head 3 -  Top:    0.063"
  51. .head 3 -  Width:  11.4"
  52. .head 3 -  Height: 5.729"
  53. .head 2 +  Options Box Location
  54. .head 3 -  Visible? No
  55. .head 3 -  Left:   4.0"
  56. .head 3 -  Top:    2.583"
  57. .head 2 -  Fully Qualified External References? No
  58. .head 1 +  Global Declarations
  59. .head 2 +  External Functions
  60. .head 3 +  Library name: SQLWIN01.EXE
  61. .head 4 +  Function: SalCreateWindow
  62. .head 5 -  Description: Create a window instance.
  63. hWndNew = SalCreateWindow( Template, hWndParent )
  64. .head 5 -  Export Ordinal: 28
  65. .head 5 +  Returns
  66. .head 6 -  Window Handle: HWND
  67. .head 5 +  Parameters
  68. .head 6 -  Template: TEMPLATE
  69. .head 6 -  Window Handle: HWND
  70. .head 4 +  Function: SalHideWindow
  71. .head 5 -  Description: Hide a window.
  72. bOk = SalHideWindow( hWndToHide )
  73. .head 5 -  Export Ordinal: 23
  74. .head 5 +  Returns
  75. .head 6 -  Boolean: BOOL
  76. .head 5 +  Parameters
  77. .head 6 -  Window Handle: HWND
  78. .head 4 +  Function: SalMessageBeep
  79. .head 5 -  Description: Beep when a message box is displayed.
  80. bOk = SalMessageBeep( nMsgBoxFlags )
  81. .head 5 -  Export Ordinal: 170
  82. .head 5 +  Returns
  83. .head 6 -  Boolean: BOOL
  84. .head 5 +  Parameters
  85. .head 6 -  Number: WORD
  86. .head 4 +  Function: SalMessageBox
  87. .head 5 -  Description: Display message box, return button response.
  88. nResult = SalMessageBox( strText, strTitle, nFlags )
  89. .head 5 -  Export Ordinal: 24
  90. .head 5 +  Returns
  91. .head 6 -  Number: INT
  92. .head 5 +  Parameters
  93. .head 6 -  String: LPSTR
  94. .head 6 -  String: LPSTR
  95. .head 6 -  Number: WORD
  96. .head 4 +  Function: SalPostMsg
  97. .head 5 -  Description: Post a message to a window.
  98. bOk = SalPostMsg( hWndReceiver, nMsg, nMywParam,
  99. nMylParam )
  100. .head 5 -  Export Ordinal: 26
  101. .head 5 +  Returns
  102. .head 6 -  Boolean: BOOL
  103. .head 5 +  Parameters
  104. .head 6 -  Window Handle: HWND
  105. .head 6 -  Number: WORD
  106. .head 6 -  Number: WORD
  107. .head 6 -  Number: LONG
  108. .head 4 +  Function: SalSendMsg
  109. .head 5 -  Description: Send a message to a window.
  110. nMsgReturn = SalSendMsg( hWnd, mMsg, nMywParam, 
  111. nMylParam )
  112. .head 5 -  Export Ordinal: 25
  113. .head 5 +  Returns
  114. .head 6 -  Number: LONG
  115. .head 5 +  Parameters
  116. .head 6 -  Window Handle: HWND
  117. .head 6 -  Number: WORD
  118. .head 6 -  Number: WORD
  119. .head 6 -  Number: LONG
  120. .head 4 +  Function: SalSetWindowText
  121. .head 5 -  Description: Set the caption title of Form or Dialog, or contents
  122. of form item.
  123. bOK = SalSetWindowText( hWnd, strTitle )
  124. .head 5 -  Export Ordinal: 40
  125. .head 5 +  Returns
  126. .head 6 -  Boolean: BOOL
  127. .head 5 +  Parameters
  128. .head 6 -  Window Handle: HWND
  129. .head 6 -  String: LPSTR
  130. .head 4 +  Function: SalShowWindow
  131. .head 5 -  Description: Make a window visible.
  132. bOk = SalShowWindow( hWndToShow )
  133. .head 5 -  Export Ordinal: 22
  134. .head 5 +  Returns
  135. .head 6 -  Boolean: BOOL
  136. .head 5 +  Parameters
  137. .head 6 -  Window Handle: HWND
  138. .head 4 +  Function: SalGetWindowText
  139. .head 5 -  Description: Get the caption title of Form or Dialog, or contents
  140. of form item.
  141. nLength = SalGetWindowText( hWnd, strText, nMaxlen )
  142. .head 5 -  Export Ordinal: 39
  143. .head 5 +  Returns
  144. .head 6 -  Number: INT
  145. .head 5 +  Parameters
  146. .head 6 -  Window Handle: HWND
  147. .head 6 -  Receive String: LPHSTRING
  148. .head 6 -  Number: INT
  149. .head 4 +  Function: SalStrSetBufferLength
  150. .head 5 -  Description: Set the length of the given string buffer.
  151. bOK = SalStrSetBufferLength( strString, nLength )
  152. .head 5 -  Export Ordinal: 96
  153. .head 5 +  Returns
  154. .head 6 -  Boolean: BOOL
  155. .head 5 +  Parameters
  156. .head 6 -  Receive String: LPHSTRING
  157. .head 6 -  Number: LONG
  158. .head 4 +  Function: SalNumberToStr
  159. .head 5 -  Description: Convert a number to a string.
  160. nLength = SalNumberToStr( nNumber, nDecimalPlaces,
  161. strString )
  162. .head 5 -  Export Ordinal: 150
  163. .head 5 +  Returns
  164. .head 6 -  Number: INT
  165. .head 5 +  Parameters
  166. .head 6 -  Number: NUMBER
  167. .head 6 -  Number: INT
  168. .head 6 -  Receive String: LPHSTRING
  169. .head 4 +  Function: SalQuit
  170. .head 5 -  Description: Quit the application.
  171. bOK = SalQuit()
  172. .head 5 -  Export Ordinal: 31
  173. .head 5 +  Returns
  174. .head 6 -  Boolean: BOOL
  175. .head 5 -  Parameters
  176. .head 4 +  Function: SalModalDialog
  177. .head 5 -  Description: Create a modal dialog box.
  178. nReturn = SalModalDialog( Template, hWndOwner )
  179. .head 5 -  Export Ordinal: 46
  180. .head 5 +  Returns
  181. .head 6 -  Number: INT
  182. .head 5 +  Parameters
  183. .head 6 -  Template: TEMPLATE
  184. .head 6 -  Window Handle: HWND
  185. .head 4 +  Function: SalEndDialog
  186. .head 5 -  Description: End a modal dialog.
  187. bOk = SalEndDialog( hWndModal, nReturn )
  188. .head 5 -  Export Ordinal: 47
  189. .head 5 +  Returns
  190. .head 6 -  Boolean: BOOL
  191. .head 5 +  Parameters
  192. .head 6 -  Window Handle: HWND
  193. .head 6 -  Number: INT
  194. .head 4 +  Function: SalSetFocus
  195. .head 5 -  Description: Set the focus to the given window.
  196. hWndOldFocus = SalSetFocus( hWndToSet )
  197. .head 5 -  Export Ordinal: 175
  198. .head 5 +  Returns
  199. .head 6 -  Window Handle: HWND
  200. .head 5 +  Parameters
  201. .head 6 -  Window Handle: HWND
  202. .head 3 +  Library name: CBDEMO.DLL
  203. .head 4 +  Function: ComboBoxAdd
  204. .head 5 -  Description: nNewIndex = ComboBoxAdd( hWndComboBox, sAddString )
  205. .head 5 -  Export Ordinal: 1
  206. .head 5 +  Returns
  207. .head 6 -  Number: INT
  208. .head 5 +  Parameters
  209. .head 6 -  Window Handle: HWND
  210. .head 6 -  String: LPSTR
  211. .head 4 +  Function: ComboBoxSelectString
  212. .head 5 -  Description: nIndex = ComboBoxSelectString( hWndComboBox, nStartPos, sPrefix )
  213. .head 5 -  Export Ordinal: 2
  214. .head 5 +  Returns
  215. .head 6 -  Number: INT
  216. .head 5 +  Parameters
  217. .head 6 -  Window Handle: HWND
  218. .head 6 -  Number: INT
  219. .head 6 -  String: LPSTR
  220. .head 4 +  Function: ComboBoxQuerySelection
  221. .head 5 -  Description: nIndex = ComboBoxQuerySelection( hWndComboBox )
  222. .head 5 -  Export Ordinal: 3
  223. .head 5 +  Returns
  224. .head 6 -  Number: INT
  225. .head 5 +  Parameters
  226. .head 6 -  Window Handle: HWND
  227. .head 4 +  Function: ComboBoxQueryText
  228. .head 5 -  Description: ComboBoxQueryText( hWndComboBox, nIndex, rsText )
  229. .head 5 -  Export Ordinal: 4
  230. .head 5 +  Returns
  231. .head 6 -  Number: INT
  232. .head 5 +  Parameters
  233. .head 6 -  Window Handle: HWND
  234. .head 6 -  Number: INT
  235. .head 6 -  Receive String: LPSTR
  236. .head 4 +  Function: ComboBoxClear
  237. .head 5 -  Description: Call ComboBoxClear( hWndComboBox )
  238. .head 5 -  Export Ordinal: 5
  239. .head 5 -  Returns
  240. .head 5 +  Parameters
  241. .head 6 -  Window Handle: HWND
  242. .head 4 +  Function: ComboBoxQueryCount
  243. .head 5 -  Description: set nCount = ComboBoxQueryCount( hWndComboBox )
  244. .head 5 -  Export Ordinal: 6
  245. .head 5 +  Returns
  246. .head 6 -  Number: INT
  247. .head 5 +  Parameters
  248. .head 6 -  Window Handle: HWND
  249. .head 4 +  Function: ComboBoxDelete
  250. .head 5 -  Description: set nRemainingCount = ComboBoxDelete( hWndComboBox, nIndex )
  251. .head 5 -  Export Ordinal: 7
  252. .head 5 +  Returns
  253. .head 6 -  Number: INT
  254. .head 5 +  Parameters
  255. .head 6 -  Window Handle: HWND
  256. .head 6 -  Number: INT
  257. .head 4 +  Function: ComboBoxQueryTextLength
  258. .head 5 -  Description: set nTextLength = ComboBoxQueryTextLength( hWndComboBox, nIndex )
  259. .head 5 -  Export Ordinal: 8
  260. .head 5 +  Returns
  261. .head 6 -  Number: INT
  262. .head 5 +  Parameters
  263. .head 6 -  Window Handle: HWND
  264. .head 6 -  Number: INT
  265. .head 4 +  Function: ComboBoxSetSelect
  266. .head 5 -  Description: Call ComboBoxSetSelect( hWndComboBox, nIndex )
  267. .head 5 -  Export Ordinal: 9
  268. .head 5 +  Returns
  269. .head 6 -  Number: INT
  270. .head 5 +  Parameters
  271. .head 6 -  Window Handle: HWND
  272. .head 6 -  Number: INT
  273. .head 4 +  Function: ComboBoxInsert
  274. .head 5 -  Description: set nPos = ComboBoxInsert( hWndComboBox, nPos, sText )
  275. .head 5 -  Export Ordinal: 10
  276. .head 5 +  Returns
  277. .head 6 -  Number: INT
  278. .head 5 +  Parameters
  279. .head 6 -  Window Handle: HWND
  280. .head 6 -  Number: INT
  281. .head 6 -  String: LPSTR
  282. .head 4 +  Function: ComboBoxShowDropdown
  283. .head 5 -  Description: Call ComboBoxShowDropdown( hWndComboBox, bState )
  284. .head 5 -  Export Ordinal: 11
  285. .head 5 -  Returns
  286. .head 5 +  Parameters
  287. .head 6 -  Window Handle: HWND
  288. .head 6 -  Boolean: BOOL
  289. .head 4 +  Function: ComboBoxLimitTextLength
  290. .head 5 -  Description: Set bOk = ComboBoxLimitTextLength( hWndComboBox, nTextLength )
  291. .head 5 -  Export Ordinal: 12
  292. .head 5 +  Returns
  293. .head 6 -  Boolean: BOOL
  294. .head 5 +  Parameters
  295. .head 6 -  Window Handle: HWND
  296. .head 6 -  Number: INT
  297. .head 4 +  Function: ComboBoxCreate
  298. .head 5 -  Description: hWndComboBox = ComboBoxCreate( hWndParent, hWndTemplate, nID, nCBType, bSort, nLBRows)
  299. .head 5 -  Export Ordinal: 13
  300. .head 5 +  Returns
  301. .head 6 -  Window Handle: HWND
  302. .head 5 +  Parameters
  303. .head 6 -  Window Handle: HWND
  304. .head 6 -  Window Handle: HWND
  305. .head 6 -  Number: WORD
  306. .head 6 -  Number: DWORD
  307. .head 6 -  Boolean: BOOL
  308. .head 6 -  Number: INT
  309. .head 4 +  Function: ComboBoxFindString
  310. .head 5 -  Description: nIndex = ComboBoxFindString( hWndComboBox, nStartPos, sPrefix )
  311. .head 5 -  Export Ordinal: 14
  312. .head 5 +  Returns
  313. .head 6 -  Number: INT
  314. .head 5 +  Parameters
  315. .head 6 -  Window Handle: HWND
  316. .head 6 -  Number: INT
  317. .head 6 -  String: LPSTR
  318. .head 2 +  Constants
  319. .head 3 +  System
  320. .head 4 -  ! Standard Boolean constants
  321. .head 4 -  Boolean: FALSE = 0
  322. .head 4 -  Boolean: TRUE  = 1
  323. .head 4 -  ! SAM messages
  324. .head 4 -  Number: SAM_AppStartup   = 0x2001
  325. .head 4 -  Number: SAM_Click        = 0x2006
  326. .head 4 -  Number: SAM_Close        = 0x0010
  327. .head 4 -  Number: SAM_Create       = 0x1001
  328. .head 4 -  Number: SAM_Destroy      = 0x1002
  329. .head 4 -  ! Start constant for user-defined messages
  330. .head 4 -  Number: SAM_User         = 0x4000
  331. .head 4 -  ! Flag options for SalMessageBox
  332. .head 4 -  Number: MB_Ok               = 0x0000
  333. .head 4 -  Number: MB_OkCancel         = 0x0001
  334. .head 4 -  Number: MB_AbortRetryIgnore = 0x0002
  335. .head 4 -  Number: MB_YesNoCancel      = 0x0003
  336. .head 4 -  Number: MB_YesNo            = 0x0004
  337. .head 4 -  Number: MB_RetryCancel      = 0x0005
  338. .head 4 -  Number: MB_IconHand         = 0x0010
  339. .head 4 -  Number: MB_IconQuestion     = 0x0020
  340. .head 4 -  Number: MB_IconExclamation  = 0x0030
  341. .head 4 -  Number: MB_IconAsterisk     = 0x0040
  342. .head 4 -  Number: MB_DefButton1       = 0x0000
  343. .head 4 -  Number: MB_DefButton2       = 0x0100
  344. .head 4 -  Number: MB_DefButton3       = 0x0200
  345. .head 4 -  Number: MB_ApplModal        = 0x0000
  346. .head 4 -  Number: MB_SystemModal      = 0x1000
  347. .head 4 -  Number: MB_NoFocus          = 0x8000
  348. .head 4 -  ! Return values for SalMessageBox
  349. .head 4 -  Number: IDABORT  = 3
  350. .head 4 -  Number: IDCANCEL = 2
  351. .head 4 -  Number: IDIGNORE = 5
  352. .head 4 -  Number: IDNO     = 7
  353. .head 4 -  Number: IDOK     = 1
  354. .head 4 -  Number: IDRETRY  = 4
  355. .head 4 -  Number: IDYES    = 6
  356. .head 3 +  User
  357. .head 4 -  Number: WM_COMMAND =0x0111
  358. .head 4 -  Number: WM_LBUTTONDOWN=0x0201
  359. .head 4 -  Number: WM_LBUTTONUP=0x0202
  360. .head 4 -  Number: WM_RBUTTONDOWN=0x0204
  361. .head 4 -  Number: WM_RBUTTONUP=0x0205
  362. .head 4 -  Number: TDS_CreateDone = SAM_User
  363. .head 4 -  ! -------------------------------------- Window styles
  364. .head 4 -  Number: CBS_SIMPLE = 1
  365. .head 4 -  Number: CBS_DROPDOWN = 2
  366. .head 4 -  Number: CBS_DROPDOWNLIST = 3
  367. .head 4 -  Number: CBS_AUTOHSCROLL = 0X40
  368. .head 4 -  ! -------------------------------------- Combo box return values
  369. .head 4 -  Number: CB_OKAY = 0
  370. .head 4 -  Number: CB_ERR =- 1
  371. .head 4 -  Number: CB_ERRSPACE = -2
  372. .head 4 -  ! -------------------------------------- Combo box notification codes
  373. .head 4 -  Number: CBN_ERRSPACE = -1
  374. .head 4 -  Number: CBN_SELCHANGE = 1
  375. .head 4 -  Number: CBN_DBLCLK = 2
  376. .head 4 -  Number: CBN_SETFOCUS = 3
  377. .head 4 -  Number: CBN_KILLFOCUS = 4
  378. .head 4 -  Number: CBN_EDITCHANGE = 5
  379. .head 4 -  Number: CBN_EDITUPDATE = 6
  380. .head 4 -  Number: CBN_DROPDOWN = 7
  381. .head 4 -  !
  382. .head 4 -  Number: IDC_SIMPLE = 128
  383. .head 4 -  Number: IDC_DROPDOWNLIST = 129
  384. .head 4 -  Number: IDC_DROPDOWN = 130
  385. .head 4 -  String: ABOUT_TEXT='Welcome!
  386.  
  387. The purpose of the Combo Toolbox is to provide you, the SQLWindows developer, and your users with a tool for the creation and manipulation of genuine, straight-from-the-heart-of-Windows Combo Boxes.  We have worked hard to create an efficient, 
  388. easy-to-use Dynamic Link Library (DLL) and would now like to make it available to the SQLWindows developers\' community.
  389.  
  390. This demo version provides you with complete, but limited, access to the DLL.  We have also provided a sample APP that you can examine to determine if you think you can use the Combo Toolbox.  You are free to create your own applications with 
  391. this demo version, but you are restricted as described in the next paragraph and you will not receive technical support.  We will, however, be quite happy to answer any questions you have about the product.
  392.  
  393. Purchase of the product entitles you to:  
  394. 1.  An uncrippled version of the DLL.
  395. 2.  A complete, fully annotated application, with examples showing you how you manipulate the various types of combo boxes.
  396. 3.  Documentation.
  397. 4.  Technical support
  398.  
  399. In order to protect our investment of time and energy the development of this product, the supplied CBDEMO.DLL has been crippled as follows:
  400.  
  401. 1.  Each time you start the supplied application, or any application you create for test purposes, you receive 100 "tickets" from the DLL.  Each access to the DLL will cost you one of those tickets.  When all of your tickets are gone, the DLL 
  402. will return CB_ERR for any call you make.  If you are writing your own test apps, be sure to check for error values returning from the combobox calls!
  403.  
  404. 2.  The ComboboxShowDropDown, ComboboxInsert and ComboboxClear functions have been disabled.
  405.  
  406. The cost for the complete package is only $50.00.  This buys you a single-use license of the DLL, documentation and support.  We have a very reasonable licensing policy for the distribution of the DLL, with a per-machine cost as low as $2.00!  
  407. Please call for details.
  408.  
  409. Thank you for evaluating this product.'
  410. .head 2 +  Variables
  411. .head 3 -  Window Handle: hWndNULL
  412. .head 3 -  Window Handle: hWndForm
  413. .head 3 -  Window Handle: hWndItem
  414. .head 3 -  Number: wParam
  415. .head 3 -  Number: lParam
  416. .head 3 -  Number: nArgCount
  417. .head 3 -  String: strArgArray[*]
  418. .head 3 -  ! Database name: default = DEMO
  419. .head 3 -  String: SqlDatabase
  420. .head 3 -  ! Authorization name: default = SYSADM
  421. .head 3 -  String: SqlUser
  422. .head 3 -  ! Password: default = SYSADM
  423. .head 3 -  String: SqlPassword
  424. .head 3 -  ! APPLICATION STUFF.  NOTHING REQUIRED FOR BASIC COMBOBOX MANIPULATION
  425. .head 3 -  String: Cities[10]
  426. .head 3 -  Window Handle: hWndMain
  427. .head 2 +  Internal Functions
  428. .head 3 +  Function: InstallCities
  429. .head 4 -  Description: Stuffs the Cities array {Find myself a city to live in...}
  430. .head 4 -  Returns
  431. .head 4 -  Parameters
  432. .head 4 -  Local variables
  433. .head 4 +  Actions
  434. .head 5 -  Set Cities[0]='Tokyo'
  435. .head 5 -  Set Cities[1]='Rome'
  436. .head 5 -  Set Cities[2]='London'
  437. .head 5 -  Set Cities[3]='Berlin'
  438. .head 5 -  Set Cities[4]='Atlanta'
  439. .head 5 -  Set Cities[5]='New York'
  440. .head 5 -  Set Cities[6]='Carrboro'
  441. .head 5 -  Set Cities[7]='Menlo Park'
  442. .head 5 -  Set Cities[8]='Sydney'
  443. .head 5 -  Set Cities[9]='Cairo'
  444. .head 2 +  Application Actions
  445. .head 3 +  On SAM_AppStartup
  446. .head 4 -  Call InstallCities()
  447. .head 4 -  Set hWndMain= SalCreateWindow( Main, hWndNULL )
  448. .head 1 +  Form Window: Main
  449. .head 2 -  Title: A Comprehensive Combo Box Gallery
  450. .head 2 -  Icon File: cbdemo.ico
  451. .head 2 +  Display Settings
  452. .head 3 -  Visible at Design time? No
  453. .head 3 -  Automatically Created at Runtime? No
  454. .head 3 -  Initial State: Normal
  455. .head 3 -  Maximizable? No
  456. .head 3 -  Minimizable? Yes
  457. .head 3 -  System Menu? Yes
  458. .head 3 -  Resizable? No
  459. .head 3 +  Window Location and Size
  460. .head 4 -  Left:   0.071"
  461. .head 4 -  Top:    0.906"
  462. .head 4 -  Width:  8.6"
  463. .head 4 -  Height: 2.563"
  464. .head 3 +  Form Size
  465. .head 4 -  Width:  Default
  466. .head 4 -  Height: Default
  467. .head 4 -  Number of Pages: Dynamic
  468. .head 2 +  Menu
  469. .head 3 +  Popup Menu: &File
  470. .head 4 -  Enabled when:
  471. .head 4 +  Menu Item: E&xit
  472. .head 5 -  Keyboard Accelerator: (none)
  473. .head 5 +  Menu Settings
  474. .head 6 -  Enabled when:
  475. .head 6 -  Checked when:
  476. .head 5 +  Menu Actions
  477. .head 6 -  Return SalQuit()
  478. .head 4 +  Menu Item: A&bout...
  479. .head 5 -  Keyboard Accelerator: (none)
  480. .head 5 +  Menu Settings
  481. .head 6 -  Enabled when:
  482. .head 6 -  Checked when:
  483. .head 5 +  Menu Actions
  484. .head 6 -  Call SalModalDialog( dlgAbout, hWndForm )
  485. .head 2 +  Contents
  486. .head 3 -  ! These three data fields serve as "templates" for the combo boxes.  They MUST 
  487. .head 3 -  ! be configured as they are here:  noneditable, invisible and borderless.  The
  488. .head 3 -  ! DLL uses these fields to size and position the combo boxes when they are created.
  489. .head 3 -  ! When the field is created (On SAM_Create) you must set a window handle to the 
  490. .head 3 -  ! value of hWndItem.
  491. .head 3 +  Data Field: fSimple
  492. .head 4 +  Data
  493. .head 5 -  Maximum Data Length: Default
  494. .head 5 -  Data Type: String
  495. .head 5 -  Editable? No
  496. .head 4 +  Display Settings
  497. .head 5 +  Window Location and Size
  498. .head 6 -  Left:   0.886"
  499. .head 6 -  Top:    0.406"
  500. .head 6 -  Width:  1.9"
  501. .head 6 -  Height: 0.25"
  502. .head 5 -  Visible? No
  503. .head 5 -  Border? No
  504. .head 5 -  Justify: Left
  505. .head 5 -  Format: Unformatted
  506. .head 5 -  Country: Default
  507. .head 4 +  Message Actions
  508. .head 5 +  On SAM_Create
  509. .head 6 -  Set hWndChildSimple = hWndItem
  510. .head 6 -  Call SalHideWindow( hWndItem )
  511. .head 3 +  Data Field: fDropDownList
  512. .head 4 +  Data
  513. .head 5 -  Maximum Data Length: Default
  514. .head 5 -  Data Type: String
  515. .head 5 -  Editable? No
  516. .head 4 +  Display Settings
  517. .head 5 +  Window Location and Size
  518. .head 6 -  Left:   3.186"
  519. .head 6 -  Top:    0.406"
  520. .head 6 -  Width:  1.9"
  521. .head 6 -  Height: 0.25"
  522. .head 5 -  Visible? No
  523. .head 5 -  Border? No
  524. .head 5 -  Justify: Left
  525. .head 5 -  Format: Unformatted
  526. .head 5 -  Country: Default
  527. .head 4 +  Message Actions
  528. .head 5 +  On SAM_Create
  529. .head 6 -  Set hWndChildDropDownList = hWndItem
  530. .head 6 -  Call SalHideWindow( hWndItem )
  531. .head 3 +  Data Field: fDropDown
  532. .head 4 +  Data
  533. .head 5 -  Maximum Data Length: Default
  534. .head 5 -  Data Type: String
  535. .head 5 -  Editable? No
  536. .head 4 +  Display Settings
  537. .head 5 +  Window Location and Size
  538. .head 6 -  Left:   5.786"
  539. .head 6 -  Top:    0.406"
  540. .head 6 -  Width:  1.9"
  541. .head 6 -  Height: 0.25"
  542. .head 5 -  Visible? No
  543. .head 5 -  Border? No
  544. .head 5 -  Justify: Left
  545. .head 5 -  Format: Unformatted
  546. .head 5 -  Country: Default
  547. .head 4 +  Message Actions
  548. .head 5 +  On SAM_Create
  549. .head 6 -  Set hWndChildDropDown = hWndItem
  550. .head 6 -  Call SalHideWindow( hWndItem )
  551. .head 3 +  Background Text: City:
  552. .head 4 +  Window Location and Size
  553. .head 5 -  Left:   0.086"
  554. .head 5 -  Top:    0.448"
  555. .head 5 -  Width:  0.529"
  556. .head 5 -  Height: 0.177"
  557. .head 4 -  Visible? Yes
  558. .head 4 -  Justify: Left
  559. .head 3 +  Background Text: CBS_SIMPLE
  560. .head 4 +  Window Location and Size
  561. .head 5 -  Left:   0.886"
  562. .head 5 -  Top:    0.115"
  563. .head 5 -  Width:  1.4"
  564. .head 5 -  Height: 0.177"
  565. .head 4 -  Visible? Yes
  566. .head 4 -  Justify: Left
  567. .head 3 +  Background Text: CBS_DROPDOWNLIST
  568. .head 4 +  Window Location and Size
  569. .head 5 -  Left:   3.186"
  570. .head 5 -  Top:    0.115"
  571. .head 5 -  Width:  2.2"
  572. .head 5 -  Height: 0.177"
  573. .head 4 -  Visible? Yes
  574. .head 4 -  Justify: Left
  575. .head 3 +  Background Text: CBS_DROPDOWN
  576. .head 4 +  Window Location and Size
  577. .head 5 -  Left:   5.786"
  578. .head 5 -  Top:    0.115"
  579. .head 5 -  Width:  2.0"
  580. .head 5 -  Height: 0.177"
  581. .head 4 -  Visible? Yes
  582. .head 4 -  Justify: Left
  583. .head 3 +  Background Text: Style:
  584. .head 4 +  Window Location and Size
  585. .head 5 -  Left:   0.086"
  586. .head 5 -  Top:    0.115"
  587. .head 5 -  Width:  0.629"
  588. .head 5 -  Height: 0.177"
  589. .head 4 -  Visible? Yes
  590. .head 4 -  Justify: Left
  591. .head 3 +  Pushbutton: pbCount
  592. .head 4 -  Title: Count Items!
  593. .head 4 +  Window Location and Size
  594. .head 5 -  Left:   5.786"
  595. .head 5 -  Top:    1.49"
  596. .head 5 -  Width:  1.8"
  597. .head 5 -  Height: 0.292"
  598. .head 4 -  Visible? Yes
  599. .head 4 -  Keyboard Accelerator: (none)
  600. .head 4 +  Message Actions
  601. .head 5 +  On SAM_Click
  602. .head 6 -  Set nCount = ComboBoxQueryCount( hWndComboBoxDropDown )
  603. .head 6 +  If nCount != CB_ERR
  604. .head 7 -  Call SalNumberToStr( nCount, 0, sCount )
  605. .head 7 -  Call SalMessageBox( 'The CBS_DROPDOWN Combo Box contains '||sCount||' items.',
  606. 'Commander Data', MB_Ok|MB_IconAsterisk )
  607. .head 6 +  Else
  608. .head 7 -  Call SalMessageBeep( 0 )
  609. .head 7 -  Call SalMessageBox( 'Error returned from ComboBox Call!','Demo',MB_Ok|MB_IconHand )
  610. .head 3 +  Multiline Field: mfText
  611. .head 4 +  Data
  612. .head 5 -  Maximum Data Length: Default
  613. .head 5 -  String Type: String
  614. .head 5 -  Editable? Yes
  615. .head 4 +  Display Settings
  616. .head 5 -  Border? Yes
  617. .head 5 -  Word Wrap? Yes
  618. .head 5 -  Vertical Scroll? No
  619. .head 5 +  Window Location and Size
  620. .head 6 -  Left:   3.186"
  621. .head 6 -  Top:    0.74"
  622. .head 6 -  Width:  4.6"
  623. .head 6 -  Height: 0.667"
  624. .head 5 -  Visible? Yes
  625. .head 4 +  Message Actions
  626. .head 5 +  On SAM_Create
  627. .head 6 -  Set mfText = 'You may type text here to satisfy any doubts as to the validity of the comboboxes'
  628. .head 2 +  Window Variables
  629. .head 3 -  Number: n
  630. .head 3 -  Window Handle: hWndComboBoxSimple
  631. .head 3 -  Window Handle: hWndComboBoxDropDownList
  632. .head 3 -  Window Handle: hWndComboBoxDropDown
  633. .head 3 -  Window Handle: hWndChildSimple
  634. .head 3 -  Window Handle: hWndChildDropDownList
  635. .head 3 -  Window Handle: hWndChildDropDown
  636. .head 3 -  Number: nIndex
  637. .head 3 -  String: sSelText
  638. .head 3 -  String: sWords
  639. .head 3 -  Number: hiWord
  640. .head 3 -  Number: nOldIndex
  641. .head 3 -  String: sRetString
  642. .head 3 -  String: sButtonText
  643. .head 3 -  Number: nCount
  644. .head 3 -  String: sCount
  645. .head 3 -  Number: nComboBoxRet
  646. .head 2 +  Message Actions
  647. .head 3 +  On SAM_Create
  648. .head 4 -  ! In order to affect a proper window's appearance we'll hide it until we're done
  649. .head 4 -  ! creating and populating the combo box.  See the explanation in the Contents
  650. .head 4 -  ! section for clarification.
  651. .head 4 -  Call SalHideWindow( hWndForm )
  652. .head 4 -  Call SalPostMsg( hWndForm, TDS_CreateDone, 0, 0 )
  653. .head 3 +  On TDS_CreateDone
  654. .head 4 -  ! Observe here the actual call to the DLL to create the combo boxes.  The Description:
  655. .head 4 -  ! line of the various calls contains an prototype of the function call.
  656. .head 4 -  ! The two vital pieces of information we need to retain are the window handle returned
  657. .head 4 -  ! from the ComboBoxCreate call and the ID number that is passed as the third parameter
  658. .head 4 -  ! to the ComboBoxCreate function.  The returned window handle is the window handle
  659. .head 4 -  ! of the combo box.  We'll pass it to any ComboBox___ functions we need to call.  The
  660. .head 4 -  ! ID, which we've defined in the constants section, is how Windows will let us know
  661. .head 4 -  ! that the user has "touched" in some way the combo box.  See the explanation at 
  662. .head 4 -  ! the WM_COMMAND message for more information.
  663. .head 4 -  !
  664. .head 4 -  Set hWndComboBoxSimple = ComboBoxCreate( hWndForm, hWndChildSimple, IDC_SIMPLE, CBS_SIMPLE, TRUE, 6)
  665. .head 4 -  Set hWndComboBoxDropDownList = ComboBoxCreate( hWndForm, hWndChildDropDownList, IDC_DROPDOWNLIST, CBS_DROPDOWNLIST, TRUE, 6)
  666. .head 4 -  Set hWndComboBoxDropDown = ComboBoxCreate( hWndForm, hWndChildDropDown, IDC_DROPDOWN, CBS_DROPDOWN, TRUE, 6)
  667. .head 4 -  !
  668. .head 4 -  ! Now we'll populate the comboboxes.  Notice the remarkable similarity to SQLWindows'
  669. .head 4 -  ! listbox (SalList___) functions.
  670. .head 4 -  Set n=0
  671. .head 4 +  While n<=9
  672. .head 5 -  Call ComboBoxAdd(hWndComboBoxSimple, Cities[n])
  673. .head 5 -  Call ComboBoxAdd(hWndComboBoxDropDownList, Cities[n])
  674. .head 5 -  Call ComboBoxAdd(hWndComboBoxDropDown, Cities[n])
  675. .head 5 -  Set n=n+1
  676. .head 4 -  Call ComboBoxSelectString( hWndComboBoxSimple, 0, 'Carr' )
  677. .head 4 -  Call ComboBoxSelectString( hWndComboBoxDropDownList, 0, 'Atl' )
  678. .head 4 -  Call ComboBoxSelectString( hWndComboBoxDropDown, 0, 'Men' )
  679. .head 4 -  ! Force display of the about box on startup.
  680. .head 4 -  Call SalModalDialog( dlgAbout, hWndForm )
  681. .head 4 -  ! now that all the hocus-pocus is done we can reveal the window.
  682. .head 4 -  Call SalShowWindow( hWndForm )
  683. .head 3 +  On WM_COMMAND
  684. .head 4 -  ! WHOA!  What's *this* message doing here?
  685. .head 4 -  ! In Windows SDK programming, child controls:  list boxes, edit fields, pushbuttons, etc
  686. .head 4 -  ! do not receive messages of their own.  They send a WM_COMMAND message to their _parent_
  687. .head 4 -  ! window informing the parent window of which control has been affected by the user
  688. .head 4 -  ! and what the user's action was.  
  689. .head 4 -  ! Anyone would agree that SQLWindows outlines provide a more accessible alternative
  690. .head 4 -  ! to humoungous switch statements that C programmers must contend with.  
  691. .head 4 -  ! Unfortunately, we have stepped somewhat out of bounds to create the comboboxes, and
  692. .head 4 -  ! therefore must also step out of bounds in order to process them.  What we've done is 
  693. .head 4 -  ! provide you with a template under which you can tuck your own code quite easily.
  694. .head 4 -  ! The wParam = ID_xxx is synonymous with the item in the contents section of the outline.
  695. .head 4 -  ! (Remember that when we created the combo box we gave each one a unique ID.  IDs 0 - 255
  696. .head 4 -  ! are available for our use in a SQLWindows application.)
  697. .head 4 -  ! Similarly, each If hiWord= CBN_xxx is similar to the On SAM_xxx Message Actions
  698. .head 4 -  ! section in the outline.  (CBN stands for Combo Box Notification, in case you were
  699. .head 4 -  ! wondering.)
  700. .head 4 +  If wParam = IDC_SIMPLE
  701. .head 5 -  Set hiWord = ( lParam & 0xFFFF0000) / 0x10000
  702. .head 5 +  If hiWord = CBN_SELCHANGE
  703. .head 6 -  ! this message is similar to the SAM_Click message that a list box receives.
  704. .head 6 -  Set nIndex = ComboBoxQuerySelection( hWndComboBoxSimple )
  705. .head 6 +  If nIndex != CB_ERR
  706. .head 7 -  Call SalGetWindowText( hWndComboBoxSimple, sRetString, 30 )
  707. .head 7 -  Call SalStrSetBufferLength( sSelText, 30 )
  708. .head 7 +  If ComboBoxQueryText( hWndComboBoxSimple, nIndex, sSelText ) = CB_ERR
  709. .head 8 -  Call SalMessageBeep( 0 )
  710. .head 8 -  Call SalMessageBox( 'Error returned from ComboBox Call!','Demo',MB_Ok|MB_IconHand )
  711. .head 7 +  Else
  712. .head 8 +  If sSelText != sRetString
  713. .head 9 +  If ComboBoxFindString( hWndComboBoxSimple, -1, sRetString ) = CB_ERR
  714. .head 10 -  Call ComboBoxAdd( hWndComboBoxSimple, sRetString )
  715. .head 9 +  Else
  716. .head 10 -  Call SalMessageBox( 'You have selected: '||sSelText, 'CBS_SIMPLE: Demo', MB_Ok )
  717. .head 8 +  Else
  718. .head 9 -  Call SalMessageBox( 'You have selected: '||sSelText, 'Test Combo Box', MB_Ok )
  719. .head 6 +  Else
  720. .head 7 -  Call SalMessageBeep( 0 )
  721. .head 7 -  Call SalMessageBox( 'Error returned from ComboBox Call!','Demo',MB_Ok|MB_IconHand )
  722. .head 7 -  Return FALSE
  723. .head 6 -  Return TRUE
  724. .head 5 +  Else If hiWord = CBN_SETFOCUS
  725. .head 6 -  ! process this message if you want to do something when the user sets the focus
  726. .head 6 -  ! to the combo box
  727. .head 6 -  Return TRUE
  728. .head 5 +  Else If hiWord = CBN_KILLFOCUS
  729. .head 6 -  ! process this message if you want to do something when the user moves the focus
  730. .head 6 -  ! away from the combobox
  731. .head 6 -  Return TRUE
  732. .head 5 +  Else If hiWord = CBN_EDITCHANGE
  733. .head 6 -  ! process this message if you want to take action after the user has done something
  734. .head 6 -  ! to update the display.  It is similar to the SAM_AnyEdit message.  Unlike the
  735. .head 6 -  ! next message, however, this message is sent *after* Windows updates the display.
  736. .head 6 -  Return TRUE
  737. .head 5 +  Else If hiWord = CBN_EDITUPDATE
  738. .head 6 -  ! process this message if you want to take action after the user has done something
  739. .head 6 -  ! to update the display.  It is similar to the SAM_AnyEdit message.  Unlike the
  740. .head 6 -  ! previous message, Windows sends this message *before* displaying any user updates.
  741. .head 6 -  Return TRUE
  742. .head 5 +  Else If hiWord = CBN_DROPDOWN
  743. .head 6 -  ! windows sends this notification message when the user presses the down button 
  744. .head 6 -  ! of a dropdown control but *before* the list box is made visible.
  745. .head 6 -  Return TRUE
  746. .head 5 +  Else
  747. .head 6 -  Return FALSE
  748. .head 4 +  If wParam = IDC_DROPDOWNLIST
  749. .head 5 -  Set hiWord = ( lParam & 0xFFFF0000) / 0x10000
  750. .head 5 +  If hiWord = CBN_SELCHANGE
  751. .head 6 -  Set nIndex = ComboBoxQuerySelection( hWndComboBoxDropDownList )
  752. .head 6 +  If nIndex != CB_ERR
  753. .head 7 -  Call SalStrSetBufferLength( sSelText, 30 )
  754. .head 7 -  Call ComboBoxQueryText( hWndComboBoxDropDownList, nIndex, sSelText )
  755. .head 7 -  Call SalMessageBox( 'You have selected: '||sSelText, 'CBS_DROPDOWNLIST: Demo', MB_Ok )
  756. .head 6 +  Else
  757. .head 7 -  Call SalMessageBeep( 0 )
  758. .head 7 -  Call SalMessageBox( 'Error returned from ComboBox Call!','Demo',MB_Ok|MB_IconHand )
  759. .head 7 -  Return FALSE
  760. .head 6 -  Return TRUE
  761. .head 5 +  Else
  762. .head 6 -  Return FALSE
  763. .head 4 +  If wParam = IDC_DROPDOWN
  764. .head 5 -  Set hiWord = ( lParam & 0xFFFF0000) / 0x10000
  765. .head 5 +  If hiWord = CBN_SELCHANGE
  766. .head 6 -  ! this message is similar to the SAM_Click message that a list box receives.
  767. .head 6 -  Set nIndex = ComboBoxQuerySelection( hWndComboBoxDropDown )
  768. .head 6 +  If nIndex != CB_ERR
  769. .head 7 -  Call SalGetWindowText( hWndComboBoxDropDown, sRetString, 30 )
  770. .head 7 -  Call SalStrSetBufferLength( sSelText, 30 )
  771. .head 7 +  If ComboBoxQueryText( hWndComboBoxDropDown, nIndex, sSelText )= CB_ERR
  772. .head 8 -  Call SalMessageBeep( 0 )
  773. .head 8 -  Call SalMessageBox( 'Error returned from ComboBox Call!','Demo',MB_Ok|MB_IconHand )
  774. .head 7 +  Else
  775. .head 8 +  If sSelText != sRetString
  776. .head 9 +  If ComboBoxFindString( hWndComboBoxDropDown, -1, sRetString ) = CB_ERR
  777. .head 10 -  Call ComboBoxAdd( hWndComboBoxDropDown, sRetString )
  778. .head 9 +  Else
  779. .head 10 -  Call SalMessageBox( 'You have selected: '||sSelText, 'CBS_DROPDOWN: Demo', MB_Ok )
  780. .head 8 +  Else
  781. .head 9 -  Call SalMessageBox( 'You have selected: '||sSelText, 'CBS_DROPDOWN: Demo', MB_Ok )
  782. .head 6 +  Else
  783. .head 7 -  Call SalMessageBeep( 0 )
  784. .head 7 -  Call SalMessageBox( 'Error returned from ComboBox Call!','Demo',MB_Ok|MB_IconHand )
  785. .head 7 -  Return FALSE
  786. .head 6 -  Return TRUE
  787. .head 5 +  Else
  788. .head 6 -  Return FALSE
  789. .head 1 +  Dialog Box: dlgAbout
  790. .head 2 -  Title: About ComboBox Demo...
  791. .head 2 +  Display Settings
  792. .head 3 -  Visible at Design time? No
  793. .head 3 -  Type of Dialog: Modal
  794. .head 3 +  Window Location and Size
  795. .head 4 -  Left:   0.357"
  796. .head 4 -  Top:    0.292"
  797. .head 4 -  Width:  8.186"
  798. .head 4 -  Height: 4.073"
  799. .head 3 -  Absolute Screen Location? No
  800. .head 2 +  Contents
  801. .head 3 +  Multiline Field: mfAboutText
  802. .head 4 +  Data
  803. .head 5 -  Maximum Data Length: Default
  804. .head 5 -  String Type: String
  805. .head 5 -  Editable? No
  806. .head 4 +  Display Settings
  807. .head 5 -  Border? Yes
  808. .head 5 -  Word Wrap? Yes
  809. .head 5 -  Vertical Scroll? Yes
  810. .head 5 +  Window Location and Size
  811. .head 6 -  Left:   0.186"
  812. .head 6 -  Top:    0.156"
  813. .head 6 -  Width:  7.5"
  814. .head 6 -  Height: 3.083"
  815. .head 5 -  Visible? Yes
  816. .head 4 +  Message Actions
  817. .head 5 +  On SAM_Create
  818. .head 6 -  Set mfAboutText = ABOUT_TEXT
  819. .head 3 +  Pushbutton: pbWOW
  820. .head 4 -  Title: Kowabunga, Dude!
  821. .head 4 +  Window Location and Size
  822. .head 5 -  Left:   2.786"
  823. .head 5 -  Top:    3.344"
  824. .head 5 -  Width:  2.3"
  825. .head 5 -  Height: 0.292"
  826. .head 4 -  Visible? Yes
  827. .head 4 -  Keyboard Accelerator: Enter
  828. .head 4 +  Message Actions
  829. .head 5 +  On SAM_Click
  830. .head 6 -  Call SalEndDialog( hWndForm, TRUE )
  831. .head 5 +  On SAM_Create
  832. .head 6 -  Call SalSetFocus( hWndItem )
  833. .head 5 +  On WM_LBUTTONDOWN
  834. .head 6 -  Call SalGetWindowText( hWndItem, sButtonText, 20 )
  835. .head 6 -  Call SalSetWindowText( hWndItem, 'Surf\'s Up!')
  836. .head 5 +  On WM_LBUTTONUP
  837. .head 6 -  Call SalSetWindowText( hWndItem, sButtonText )
  838. .head 2 -  Window Variables
  839. .head 2 -  Message Actions
  840.